import http from "@/api";

import { ResPage } from "@/api/interface";

import { JobVo, OddJobEntity } from "@/biz/interface/JobType";

import { ModuleMainUrl } from "..";

const moduleUrl = ModuleMainUrl;

// * 获取发布的岗位列表
export const getJobVoListApi = (params: {}) => {
  return http.post<ResPage<JobVo>>(moduleUrl + `/cpyjob/ojvolist`, params);
};

// * 新增发布的岗位接口
export const saveJobApi = (job: OddJobEntity) => {
  return http.post(moduleUrl + `/cpyjob/ojsave`, job);
};

// * 详情发布的岗位接口
export const getJobInfoApi = (params: { id: string }) => {
  return http.post<OddJobEntity>(moduleUrl + `/cpyjob/ojinfo`, params);
};

// * 获取下一个要审核的零工岗位
export const getNextJobApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyjob/jobrpnextitem`, params);
};

// * 删除发布的岗位接口
export const deleteJobApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyjob/ojdelete`, params);
};

// * 正在招聘中的岗位下架
export const setJobOffline = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyjob/ojoffline`, params);
};
